package pkg

import (
	"fmt"
	"net"

	"github.com/urfave/cli"
)

func Cname() cli.Command {
	return cli.Command{
		Name:  "cname",
		Usage: "Looks up the CNAME for a particular host",
		Action: func(c *cli.Context) error {
			cname, err := net.LookupCNAME(c.Args().Get(0))
			if err != nil {
				return err
			}
			fmt.Printf("cname: %s\n", cname)
			return nil
		},
	}
}
